﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Parallel3M.parallel3m.framework;
using Parallel3M.parallel3m.protocol;
using System.Collections;

namespace Parallel3M.parallel3m.framework
{
    public class ProtocolParallelApplication:ParallelApplication
    {
                
        public void addProtocol(string protocolfile)
        {
            ProtocolProtype protocol = new ProtocolProtype();
            protocol.app = this;
            protocol.loadProtocolfile(protocolfile);
            ParallelProtocolContext.protocols.Add(protocol.name, protocol);
        }

        public void Send_Command(string protocolName, string pcsd, string command, Hashtable parameters)
        {
            ProtocolProtype protocol = (ProtocolProtype)ParallelProtocolContext.protocols[protocolName];
            ProtocolPayload payload_command = protocol.Send_Protocol_Command_Request(command, parameters, 2);
            payload_command.pcs_source = pcsid;
            payload_command.pcs_des = pcsd;
            userSingleTaskChannel.AddPayload(payload_command);
        }

    }
}
